package cn.masterj.springcloud.controller;

import cn.masterj.springcloud.CommonResult;
import cn.masterj.springcloud.entity.Order;
import cn.masterj.springcloud.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author masterJ
 * @create 2020-04-20 17:40
 */
@RestController
public class OrderController {

    @Autowired
    private IOrderService orderService;

    @GetMapping("/order/getById/{id}")
    public CommonResult<Order> getById(@PathVariable("id") Long id){
        Order order = orderService.getById(id);
        return new CommonResult<>(200,"查询成功", order);
    }

    @GetMapping("/order/create")
    public CommonResult<Order> create(){
        Order order = orderService.create();
        return new CommonResult<>(200,"创建成功", order);
    }



}
